package com.hsh.erp.controller;

import com.hsh.erp.domain.common.Result;
import com.hsh.erp.domain.dto.ShopDTO;
import com.hsh.erp.domain.vo.ShopVO;
import com.hsh.erp.service.ShopService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author USER
 * @description 针对表【shop】的数据库操作Service实现
 * @createDate 2024-05-30 16:21:43
 */
@RestController
@RequestMapping("/shop")
@Tag(name = "店铺", description = "店铺")
public class ShopController {

    @Resource
    private ShopService shopService;

    /**
     * 获取所有店铺
     *
     * @param
     * @return
     */
    @GetMapping("/all")
    @Operation(summary = "获取所有店铺")
    public Result<List<ShopDTO>> getAll() {
        return shopService.getAll();
    }
    /**
     * 列表查询
     *
     * @param shopVO
     * @return
     */
    @GetMapping("/list")
    @Operation(summary = "列表查询")
    public Result<List<ShopDTO>> getList(ShopVO shopVO) {
        return shopService.getList(shopVO);
    }

    /**
     * 修改一条记录
     *
     * @param shopVO
     * @return
     */
    @PostMapping("/updateOne")
    @Operation(summary = "修改一条记录")
    public Result updateOne(@RequestBody ShopVO shopVO) {
        return shopService.updateOne(shopVO);
    }

    /**
     * 删除一条记录
     *
     * @param shopVO
     * @return
     */
    @PostMapping("/deleteOne")
    @Operation(summary = "删除一条记录")
    public Result deleteOne(@RequestBody ShopVO shopVO) {
        return shopService.deleteOne(shopVO);
    }

    /**
     * 新增一条记录
     *
     * @param shopVO
     * @return
     */
    @PostMapping("/addOne")
    @Operation(summary = "新增一条记录")
    public Result addOne(@RequestBody ShopVO shopVO) {
        return shopService.addOne(shopVO);
    }

}




